<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>服务项目列表</title>
		<script src="../js/mui.min.js"></script>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/style.css" />
		<link rel="stylesheet" href="../css/member.css" />
		<link rel="stylesheet" href="../css/picker.css" />
		<link rel="stylesheet" href="../css/poppicker.css" />
		<link rel="stylesheet" type="text/css" href="../css/datepicker3.css" />
		<script src="../plugin/crop/croppie.min.js"></script>
		<link rel="stylesheet" href="../css/font-awesome.min.css" />
		<link rel="stylesheet" href="../css/bootstrap.min.css" />

	</head>
	<style>
		ul li {
			list-style-type: none;
		}
	</style>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a href="../member/member_index.html" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">服务项目列表</h1>
			<a href="goodcreate.html" style="float: right;"><button type="button" class="mui-btn mui-btn-danger">添加</button></a>
		</header>
	
		<div class="mui-content">
			
			<ul class="mui-table-view">
				
			<li class="mui-table-view-cell mui-media" id="store_ul">
				
					<!--<div class="ddxinxi">
						<div class="ddone">
							<img class="mui-media-object mui-pull-left" src="images/b001.jpg">
							<h3>商品名称：xxx</h3>	
						<button type="button" class="mui-btn mui-btn-primary">编辑</button>
						<button type="button" class="mui-btn mui-btn-danger">删除</button>
						</div>
						
					</div>-->
				</li>
			</ul>
			<!--<div class="foot50"></div>-->
		</div>
<div id="footer"></div>
	</body>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/app.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>
	<script>
//	dlpd();
//	get_navigation();
//getFoot(getUrlParam("foot_active") > 0 ? getUrlParam("foot_active") : 4);
//			
//
//		var loading = layer.load(0, {
//			shade: false,
//			time: 1 * 1000
//		});
		var member=JSON.parse(localStorage.getItem('member'));
			$.ajax({
				//type: 'post',
				url: APP.api_url + 'goods/bianji',
				data: {
					member_id:member['id']
				},
				dataType:'jsonp',
				success: function(data) {
					if(data.code == 200) {
						var json = data.data;						
						var store_htm = "";
						if(json.length !=0 ){
							for(var i = 0; i < json.length; i++) {
							var strs=json[i].content.split("@");
					store_htm += '<li class="mui-table-view-cell mui-media" id="store_ul">'+
					'<div class="ddxinxi"><div class="ddone">'+
					'<img class="mui-media-object mui-pull-left" src="'+APP.pic_url+strs[0]+'"><h3>'+json[i].goods_name+'</h3>'+
						'<button type="button" class="mui-btn mui-btn-primary"  onclick="bian('+json[i].id+')">编辑</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
						'<button type="button" class="mui-btn mui-btn-danger" onclick="shan('+json[i].id+')">删除</button></div></div></li>';
							}
						}else{
							store_htm+='<h3>您还没有商品，赶快添加吧</h3>';
						}
						
						$("#store_ul").empty();
						$("#store_ul").append(store_htm);
					} else {
						console.log(data.msg);
					}
				}
			});
			
			
			//编辑
			function bian(id){
				localStorage.setItem('goods_id', id);
				window.location.href="goodsbj.html";    
			}
			
			//删除
			function shan(id){
			layer.confirm('是否确定删除？', {
 			 btn: ['确定','取消'] //按钮
			}, function(){
  			$.ajax({
				type:"post",
				url:APP.api_url + "goods/shan1",
				data:{goods_id:id},
				dataType:'jsonp',
				success:function(data){
				if(data.code==200){
						layer.msg(data.msg,{icon:2,time:1500,shade: 0.1}, function(index){
						window.location.href="";    
                		});
					}else{
							layer.msg(data.msg,{icon:2,time:1500,shade: 0.1}, function(index){
							window.location.href="";    
                		});
					}
			
				},
	
					});
			});
	
			}
	</script>

</html>